.\" Copyright (C) 2014 Shang-Rong Cai. All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $ DIDF: did_head.3    Rev. 0.1.1    2014-04-18T00:48+08:00 $
.TH DID_HEAD 3 2014-04-18 "DIDF 0.1" "Duplex Index Data File Manual"
.SH NAME
\fBdid_head_t\fP, \fBdid_head_set_info\fP, \fBdid_head_stdout\fP - head part of
duplex index data file
.SH SYNOPSIS
\fB#include <did.h>\fP

\fIdid_head_t hdprt;\fP

\fIint\fP
.br
\fBdid_head_set_info\fP(\fIdid_head_t\fP \fI*hdprt\fP,
\fIconst\fP \fIuint8_t\fP \fIidxtyp\fP,
.br
    \fIconst\fP \fIuint8_t\fP \fIenttyp\fP);

\fIint\fP
.br
\fBdid_head_stdout\fP(\fIconst\fP \fIdid_head_t\fP \fI*hdprt\fP);

.SH DESCRIPTION
The fuction \fBdid_head_set_info\fP() is using to create a proper header for
file with respect the to data entries to storing.  On the other hand, the
function \fBdid_head_stdout\fP() is to show the settings to the standard output
(screen).  The parameters of basic functions for \fBdid_head_t\fP data
structure:
.TP
\fBhdprt\fP
The data structure objects.
.TP
\fBidxtyp\fP
The index data type.  There are two types which are 32 bits integer and 64 bits
integer.  The vaild values are setting by the macro \fBDID_HEAD_INDEX_T_I32\fP
(0x04) for 32 bits integer, and \fBDID_HEAD_INDEX_T_I64\fP (0x08) for 64 bits
integer.
.TP
\fBenttyp\fP
The data entry type.  There are six types which are single precision floating
point number (32 bits), double precision floating point number (64 bits),
single precision complex floating point number (64 bits), double precision
complex floating point number (128 bits), 32 bits signed integer, and 64 bits
signed integer.

.LP
The return value is the error number.  If the return value of the fucntion
\fBdid_head_set_info\fP() is \fBERRNO_UNKNOWN_TYPE\fP that means the setting of
wrong type of index or data entry.

The data structure \fBdid_head_t\fP is define as the following.

.nf
typedef struct
{
    char identify[DID_HEAD_IDC_SIZE];  /* File identify */
    uint8_t index_type;  /* Index type */
    uint8_t entry_type;  /* Data entry type */
    uint64_t endian_type;  /* Endianness type */
    char ver_num[DID_HEAD_NUM_SIZE];  /* Version number */
    char ver_tag[DID_HEAD_TAG_SIZE];  /* Version tag */
} did_head_t;

.fi

The macros \fBDID_HEAD_IDC_SIZE\fP, \fBDID_HEAD_NUM_SIZE\fP, and
\fBDID_HEAD_TAG_SIZE\fP are the size of bytes for memory using or file.

.SH SEE ALSO
did_read_head(3)
